﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Windvoice.Blog.Model
{
    public class CommentInfo
    {
        private int _ID;
        private int _ArticleID;
        private int _AuthorID;

        private string _Author;
        private string _Content;
        private string _IP;
        private string _Reply;
        private string _ReplyAuthor;
        private string _ReplyIP;

        private DateTime _ReplyTime;
        private DateTime _Time;


        public CommentInfo()
        { }

        public CommentInfo(DataRow row)
        {
            _ID = int.Parse(row["id"].ToString());
            _ArticleID = int.Parse(row["articleid"].ToString());
            _AuthorID = int.Parse(row["authorid"].ToString());

            _Author=row["author"].ToString();
            _Content=row["content"].ToString();
            _IP=row["ip"].ToString();
            _Reply=row["reply"].ToString();
            _ReplyAuthor=row["replyauthor"].ToString();
            _ReplyIP=row["replyip"].ToString();

            _ReplyTime = row["replytime"].ToString() == string.Empty ? DateTime.Now : DateTime.Parse(row["replytime"].ToString());
            _Time=DateTime.Parse(row["time"].ToString());
        }

        public int ID 
        {
            get { return _ID; }
            set { _ID = value; }
        }
        public int ArticleID
        {
            get { return _ArticleID; }
            set { _ArticleID = value; }
        }
        public int AuthorID
        {
            get { return _AuthorID; }
            set { _AuthorID = value; }
        }

        public string Author
        {
            get { return _Author; }
            set { _Author = value; }
        }
        public string Content
        {
            get { return _Content; }
            set { _Content = value; }
        }
        public string IP
        {
            get { return _IP; }
            set { _IP = value; }
        }
        public string Reply
        {
            get { return _Reply; }
            set { _Reply = value; }
        }
        public string ReplyAuthor
        {
            get { return _ReplyAuthor; }
            set { _ReplyAuthor = value; }
        }
        public string ReplyIP
        {
            get { return _ReplyIP; }
            set { _ReplyIP = value; }
        }

        public DateTime ReplyTime
        {
            get { return _ReplyTime; }
            set { _ReplyTime = value; }
        }
        public DateTime Time
        {
            get { return _Time; }
            set { _Time = value; }
        }
    }
}
